//
//  ViewController.m
//  ygj-customer-iOS
//
//  Created by apple on 16/11/8.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ViewController.h"
#import "HXExtension.h"
#import "HXNetwork.h"
//#import "WeatherModel.h"
#import "MJExtension.h"

#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

@interface ViewController ()

@property(nonatomic,strong) NSMutableArray * datas;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    
    self.datas = [NSMutableArray array];
    /*!
     @author 吕浩轩, 16-03-17 14:03:03
     
     每次请求后 header / HXResponseMethod / HXRequestSerializerMethod 恢复默认值
     当然如果另有需求可以自己更改...
     
     一般写在 AppDelegate
     */
    HXResponseManager *manager = [HXResponseManager manager];
    [manager updateBaseUrl:@"http://apis.baidu.com/heweather/weather/free"];
    
    
    
    
    
    
    
    
    /*!
     @author 吕浩轩, 16-03-17 14:03:49
     
     GET
     */
    [manager configCommonHttpHeaders:@{@"apikey":@"8e4dd1aebc9f047a58da2a0baeadfd34"}];
    //这里可以直接给 http:// .......
    [manager getWithUrl:@"" success:^(NSURLSessionDataTask * _Nullable task, id  _Nullable responseObject) {
        
        for (NSDictionary *dic in [responseObject objectForKey:@"HeWeather data service 3.0"]) {
            
                      
        }
    } fail:^(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error) {
        
    }];
    
    
    
    
    
    
    
    
    
    /*!
     @author 吕浩轩, 16-03-17 14:03:33
     
     POST
     */
    [manager configCommonHttpHeaders:@{@"apikey":@"8e4dd1aebc9f047a58da2a0baeadfd34"}];
    [manager configCache:YES];
    [manager postWithUrl:nil params:@{@"city":@"北京"} success:^(NSURLSessionDataTask * _Nullable task, id  _Nullable responseObject) {
        
        //code...
        
    } fail:^(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error) {
        
    }];
    
    

    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
